< previous page page_776 next page >

Page 776
After you complete your program, it is time to move it out of the VB development environment so that others can use it. The first step is to compile the source code. The objective here is to create an EXE file (or DLL/OCX depending on the project type) that can be distributed to other machines. After compiling, you can create installation files for the program by using the Package and Deployment Wizard. The purpose of this wizard is to package your program and all necessary support files so that it will run on a machine that does not have Visual Basic installed. If your program is a Standard EXE project, the Package and Deployment Wizard provides a setup program that the users can execute. Typically, they can insert a CD or diskette and run SETUP.EXE. In addition to creating installs for Standard EXE projects, the Package and Deployment Wizard can also be used with ActiveX controls or other ActiveX components. This appendix discusses compiling your program and then steps you through the process of using the wizard to create an application package.
note.gif The Package and Deployment Wizard replaces the Application Setup Wizard from earlier versions of Visual Basic. square.gif

Compiling Your Program
The first step toward distributing your program is to compile it. All you have to do is select File, Make. This menu item lists the project name and the proper file extension for the type of program you are creating. For a Standard EXE or ActiveX EXE, the file extension is .EXE. For an ActiveX DLL, the file extension is .DLL, and for the ActiveX control, the file extension is .OCX. After you select Make, the Make Project dialog box appears; this dialog box allows you to specify the name and location of the target file. Visual Basic then does the rest of the work.
If any errors that prevent a successful compile are encountered, you have to correct them and compile again. Any time you make changes to the program code after you have compiled it, you need to compile and distribute your project again. Although Visual Basic handles the actual compilation with no intervention, you do need to make a few decisions in the projectname Project Properties dialog box. The Compile and Make tabs of this dialog box are also available through the Options button on the Make Project dialog box.
Optimizing Your Code
The first choice to make is whether to compile to P-code or native code. P-code is the way Visual Basic programs have been compiled since version 1, whereas compiling to native code was a new option with Visual Basic 5.0. Native code is optimized for the processor chip and runs faster than P-code, but it produces a larger executable file. If you choose to compile to native code, you also need to make a decision about compiler optimization. You can choose to have the compiler try to create the smallest possible code, the fastest possible code, or not perform any optimization. You also have the option of compiling your program specifically for the Pentium Pro processor.

 
< previous page page_776 next page >